package com.ximcontroller.controllers;
//import org.sqlite.SQLite;

import processing.core.PApplet;

import de.bezier.data.sql.SQLite;


public class XIMPersistence { 
	
	PApplet p; 
	SQLite db; 
 
	
	//database structure 
	//subject: id 
	//experiments: id, id_subject, numTile, timestamp 
	//scores: id, score_w, score_wo 
	
	public XIMPersistence(PApplet p) { 
		this.p = p; 
		
		try {
		    db = new SQLite( p, "test.db" );  // open database file 
		    db.connect(); 
		} catch (Exception e) {
			// TODO: handle exception
		}		
		
	} 
	

	public void create() { 
		db.query("CREATE TABLE SUBJECT (timestamp datetime default CURRENT_TIMESTAMP)"); 
		db.query("CREATE TABLE EXPERIMENT (id_subject int, num_tile int, timestamp datetime default CURRENT_TIMESTAMP)"); 
		db.query("CREATE TABLE SCORES (id_subject int, id_experiment int, score_w, score_wo, timestamp datetime default CURRENT_TIMESTAMP)"); 
		db.query("CREATE TABLE subject (timestamp datetime default CURRENT_TIMESTAMP)"); 

		
		
	} 
	
	
	public void insertSubject() { 
		
		
	}
	
	
} 
